package ArrayList;

import java.util.ArrayList;

public class base_note {
    public static void main(String[] args) {
        //1.集合的创建（优点：自动扩容）(new 时候长度为0)
        ArrayList<String> list = new ArrayList<>();
        ArrayList<Integer> list1 = new ArrayList<>();
        //2.基本方法：
        //list.add(); list.remove(); list,set(); list.get();
        //
        list.add("abc");
        list.add("def");
        System.out.println(list);
        //3.引用类型的集合
        ArrayList<student> stulist = new ArrayList<>();
        student s1 = new student("张三",17);
        student s2= new student("李砳",19);
        stulist.add(s1);
        stulist.add(s2);
        System.out.println(stulist);
        for (int i = 0; i < stulist.size(); i++) {
            student stu = stulist.get(i);
            System.out.println(stu.getName()+","+stu.getAge());
        }
    }
}
